<%@ page import="com.goal98.team.Constants" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <title><g:message code="activity.list" default="Activity List"/></title>
</head>
<body>
    <div class="nav">
        <g:ifAnyGranted role="${Constants.ROLE_TEAM_ADMIN}">
            <span class="menuButton"><g:link class="create" action="create"><g:message code="activity.new" default="New Activity"/></g:link></span>
        </g:ifAnyGranted>
    </div>
    <div class="body">
        <h1><g:message code="activity.list" default="Activity List"/></h1>
        <g:if test="${flash.message}">
            <div class="message"><g:message code="${flash.message}" args="${flash.args}" default="${flash.defaultMessage}"/></div>
        </g:if>
        <div class="list">
            <table>
                <thead>
                <tr>

                    <g:sortableColumn property="id" title="Id" titleKey="activity.id"/>

                    <th><g:message code="activity.team" default="Team"/></th>

                    <g:sortableColumn property="activityTime" title="Activity Time" titleKey="activity.activityTime"/>

                    <g:sortableColumn property="venue" title="Venue" titleKey="activity.venue"/>

                    <g:sortableColumn property="description" title="Description" titleKey="activity.description"/>

                    <g:sortableColumn property="totalCost" title="Total Cost" titleKey="activity.totalCost"/>

                    <g:sortableColumn property="actualPersonCount" title="Actual Person Count" titleKey="activity.actualPersonCount"/>

                    <g:sortableColumn property="costOfEachPerson" title="Cost Of Each Person" titleKey="activity.costOfEachPerson"/>

                </tr>
                </thead>
                <tbody>
                <g:each in="${activityInstanceList}" status="i" var="activityInstance">
                    <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">

                        <td><g:link action="show" id="${activityInstance.id}">${fieldValue(bean: activityInstance, field: "id")}</g:link></td>

                        <td>${fieldValue(bean: activityInstance, field: "team")}</td>

                        <td><g:formatDate date="${activityInstance.activityTime}"/></td>

                        <td>${fieldValue(bean: activityInstance, field: "venue")}</td>

                        <td>${fieldValue(bean: activityInstance, field: "description")}</td>

                        <td><g:formatNumber number="${activityInstance.totalCost}"/></td>

                        <td><g:formatNumber number="${activityInstance.actualPersonCount}"/></td>

                        <td><g:formatNumber number="${activityInstance.costOfEachPerson}"/></td>



                    </tr>
                </g:each>
                </tbody>
            </table>
        </div>
        <div class="paginateButtons">
            <g:paginate total="${activityInstanceTotal}"/>
        </div>
    </div>
</body>
</html>
